<?
require_once 'config.php';
$bg_errorMsg = '';
$bg_success = '';
$action = getValue('action','str','POST','');
if($action == 'execute'){
    $name_field = getValue('name','str','POST','',2);
    $email_field = getValue('email','str','POST','',2);
    if(!filter_var($email_field, FILTER_VALIDATE_EMAIL)){
        $bg_errorMsg .= 'Email không đúng định dạng <br>';
    }
    $title_field = getValue('title','str','POST','',2);
    $content_field = getValue('content','str','POST','',2);
    $con_date = time();
    $myform = new generate_form();
    $myform->add('con_name','name_field',0,1,'',1,'Bạn chưa nhập tên');
    $myform->add('con_email','email_field',0,1,'',1,'Bạn chưa nhập email');
    $myform->add('con_subject','title_field',0,1,'',1,'Bạn chưa nhập tiêu đề');
    $myform->add('con_detail','content_field',0,1,'',1,'Bạn chưa nhập nội dung');
    $myform->add('con_date','con_date',1,1,0);
    $myform->addTable('contact');
    $bg_errorMsg .= $myform->checkdata();
    if($bg_errorMsg == ''){
        $db = new db_execute($myform->generate_insert_SQL());
        $bg_success = 1;
    }
    
}
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="vi" lang="vi" xmlns:og="http://ogp.me/ns#" xmlns:fb="">
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <link type="image/x-icon" href="/favicon.ico" rel="icon" />
   
   <title>Tin tức - CÔNG TY TNHH VẬT TƯ CÔNG NGHIỆP ĐÔNG ANH</title>
   <meta name="description" content=""/>
   <meta name="keywords" content=""/>
   <meta name="AUTHOR" content="Vnupdate" />
   <meta name="COPYRIGHT" content="" />
   <meta name="ROBOTS" content="INDEX, FOLLOW" />
   <meta name="RATING" content="GENERAL" />
   
   <meta property="og:title" content="" />
   <meta property="og:type" content="website" />
   <meta property="og:url" content="" />
   <meta property="og:image" content="" />
   <meta property="og:site_name" content="" />
   <meta property="og:description" content="" />
   <meta property="fb:admins" content="" />
   <meta property="fb:app_id" content=""/> 
   <!-- css -->   
   <link rel="stylesheet" type="text/css" href="/home/css/home.css" />	
   <link rel="stylesheet" type="text/css" href="/home/css/product.css" />
   <link rel="stylesheet" type="text/css" href="/home/css/news.css" />
   <!-- js -->
   <script type="text/javascript" src="/home/js/jquery-1.9.0.min.js"></script>
   <script type="text/javascript" src="<?=TEMPLATE_PATH?>js/common.js"></script>
</head>
<body>   
   <? include('view/common/vic_header.php');?>
   <div class="global_container">
      <div class="slider">
         <?include('view/common/vic_slide.php')?>
      </div>
      <div class="content_wrap">
         <div class="content_left">
            <?include('view/common/vic_content_left.php')?>
            
         </div>
         <div class="content_right">
            <?include('view/common/vic_contact.php')?>
         </div>
      </div>
      <?include('view/common/vic_social_networking.php');?>
   </div>
   <?include('view/common/vic_footer.php');?>
</body>
</html>